import React from 'react';
import CommonList from '../../components/CommonLists/list';
import { Button } from 'antd';

class PolicyList extends CommonList {
  constructor(props) {
    super(props);
    this.api = 'strategyLabsApi';
    this.operatorWidth = 200;
    this.state = {
      events: []
    };
    this.libDetailButton = record => {
      return (
        <Button
          size='small'
          type='link'
          onClick={() => this.props.history.push('/strategyLabs/' + record.lab_id + '/detail')}
        >
          试验详情
        </Button>
      );
    };
    // this.policyDetailButton = record => {
    //   return (
    //     <Button
    //       size='small'
    //       type='link'
    //       onClick={() => this.props.history.push('/strategyLabs/' + record.lab_id + '/edit')}
    //     >
    //       策略详情
    //     </Button>
    //   );
    // };
    this.delButton = record => {
      return (
        <Button
          size='small'
          type='link'
          disabled={record.audit_status === this.AUDIT._WAIT}
          onClick={this.delete.bind(this, record)}
        >
          删除
        </Button>
      );
    };
    this.btnGroup = [this.libDetailButton, this.delButton];
  }

  // 删除时的参数
  getDeleteParam = record => {
    return { lab_id: record.lab_id };
  };
}

export default PolicyList;
